package com.tengju.data.domain.model.user;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;

@Getter
@AllArgsConstructor
public enum StarRoleEnum {
    NONE(0,"没有星级","经销商"),
    SERVICE_PROVIDER(100, "服务商","城市服务商"),
    OPERATOR(200, "运营商","区域运营商");

    private Integer code;
    private String desc;
    private String appShowName;


    public static StarRoleEnum parseByRole(Integer starRole) {
        return Arrays.stream(StarRoleEnum.values())
                .filter(k -> k.getCode().equals(starRole))
                .findFirst().orElse(null);
    }

    public static boolean isServiceProvider(StarRoleEnum starRole) {
        return SERVICE_PROVIDER.equals(starRole);
    }

    public static boolean isOperator(StarRoleEnum starRole) {
        return OPERATOR.equals(starRole);
    }


}
